home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: What is wrong with this loop?
- Date: Sun, 21 Apr 96 00:08:31 GMT
- Organization: none
- Message-ID: <830045311snz@genesis.demon.co.uk>
- References: <4l86la$1t9@uwm.edu> <4l8apa$kv8@spanky.pls.ov.com> <4lb6sj$c5c@abel.cc.sunysb.edu>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4lb6sj$c5c@abel.cc.sunysb.edu>
- dkat@psych1.psy.sunysb.edu "DK" writes:
-
- >
- >/* I assume you mean
- > while (cd != 'm' || cd != 'f' || cd != 'o')
- >/*try using gets(line) - it is always safer*/
-
- You obviously haven't been reading the newsgroup for very long or the FAQ
- for that matter. I refer you to:
-
- 12.23: Why does everyone say not to use gets()?
-
- A: Unlike fgets(), gets() cannot be told the size of the buffer
- it's to read into, so it cannot be prevented from overflowing
- that buffer. As a general rule, always use fgets(). See
- question 7.1 for a code fragment illustrating the replacement of
- gets() with fgets().
-
- References: Rationale Sec. 4.9.7.2; H&S Sec. 15.7 p. 356.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-